package co.yixiang.yshop.module.shop.controller.app.recharge;

import co.yixiang.yshop.framework.common.enums.ShopCommonEnum;
import co.yixiang.yshop.framework.common.pojo.CommonResult;
import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
import co.yixiang.yshop.framework.security.core.annotations.PreAuthenticated;
import co.yixiang.yshop.module.shop.controller.admin.recharge.vo.RechargeExportReqVO;
import co.yixiang.yshop.module.shop.controller.app.recharge.vo.*;
import co.yixiang.yshop.module.shop.convert.recharge.RechargeConvert;
import co.yixiang.yshop.module.shop.dal.dataobject.recharge.RechargeDO;
import co.yixiang.yshop.module.shop.service.recharge.RechargeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;

import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;

@Tag(name = "充值金额")
@RestController
@RequestMapping("/recharge")
@Validated
public class AppRechargeController {

    @Resource
    private RechargeService rechargeService;



    @GetMapping("/getMoneyList")
    @Operation(summary = "获得充值金额列表")
    @PreAuthenticated
    public CommonResult<List<AppRechargeListVO>> getRechargeList() {
        RechargeExportReqVO exportReqVO = new RechargeExportReqVO();
        exportReqVO.setStatus(ShopCommonEnum.IS_STATUS_1.getValue());
        List<RechargeDO> list = rechargeService.getRechargeList(exportReqVO);
        return success(RechargeConvert.INSTANCE.convertList03(list));
    }


}
